package com.common;


import com.common.typeenum.StringValuedEnum;

/**
 * 登录错误类型
 * @author Eason
 *
 */
public enum LoginErrorTypeEnum implements StringValuedEnum {

	TIMEOUT("请求超时",0),
	
	INVALID("凭证无效",1),
	
	UNKNOWN("未知错误",2),
	
	UNAUTHORIZED("未授权",3)
	
	;
	
	private Integer index;
	private final String value;
	
	private LoginErrorTypeEnum(final String value, int index){
		this.value = value;
		this.index = index;
	}
	
	public String getValue() {
        return this.value;
    }
	
	@Override
	public String getName() {
		return name();
	}

	@Override
	public String getLabel() {
		return this.value;
	}

	@Override
	public String getDesc() {
		return null;
	}
	
	
	public Integer getIndex() {
		return index;
	}
	
	public void setIndex(Integer index){
		this.index = index;
	}
	
	/**
	 * 根据Index 检索ResourceCategoryEnum
	 * @param i
	 * @return
	 */
	public static LoginErrorTypeEnum valueOf(Integer i){
		for(LoginErrorTypeEnum item: LoginErrorTypeEnum.values()){
			if (item.index == i){
				return item;
			}
		}
		return null;
	}
	
	public static void main(String[] args){
	}
}